package controller.validator;

import entity.Bid;
import exception.InputValidationErrors;

public class SectionStudentValidator extends Validator {

	private String userId;
	private String courseCode;
	private String sectionCode;
	private Bid bid;

	public Bid getBid() {
		return bid;
	}
	
	public SectionStudentValidator(String courseCode, String sectionCode,
			String userId) {
		super();
		this.userId = userId;
		this.courseCode = courseCode;
		this.sectionCode = sectionCode;
	}

	@Override
	public void performValidationBeforeAdding() throws InputValidationErrors {
		// TODO Auto-generated method stub

	}

	@Override
	public void performValidationBeforeUpdating() throws InputValidationErrors {
		// TODO Auto-generated method stub

	}

	@Override
	public void performValidationBeforeDeleting() throws InputValidationErrors {
		/*
		 * Validation for no such enrollment record
		 */
		try {
			bid = checkForSectionStudentEnrollment(courseCode, sectionCode, userId);
		} catch (Exception e) {
			throw new InputValidationErrors(Validator.NO_SUCH_ENROLLMENT_RECORD);
		}
	}

}
